<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址：https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------

namespace app\admin\controller\order;

use app\common\controller\Backend;
use app\dict\order\OrderDict;


use app\admin\service\order\OrderService;
use think\Response;

class Order extends Backend
{


    /**
     * 订单列表
     * @return Response
     */
    public function lists()
    {
        $data = $this->request->params([
            [ 'order_no', '' ],
            [ 'status', '' ],
            [ 'nickname',''],
            [ 'mobile','']
        ]);
        return success(( new OrderService() )->getPage($data));
    }

    /**
     * 订单详情
     * @param int $order_id
     * @return Response
     */
    public function detail(int $order_id)
    {
        return success(( new OrderService() )->getDetail($order_id));
    }


    /**
     * 订单审核
     * @return Response
     */
    public function check()
    {
        $data = $this->request->params([
            [ 'id', '' ],
            [ 'type', '' ], // 1-直接收货，2-拒绝，3-协商价格
            [ 'remark',''], // 平台留言、拒绝理由
            [ 'unboxing_video',''], // 开箱视频
            [ 'consult_money',''] // 协商金额
        ]);
        $this->validate($data, 'app\admin\validate\order\Order.check');
        $data['auth_id'] = $this->auth->id;
        return success(( new OrderService() )->check($data));
    }

    /**
     * 获取订单状态
     * @return Response
     */
    public function orderStatus()
    {
        return success(OrderDict::getStatus());
    }





    public function getPackage()
    {
        $data = $this->request->params([
            [ 'id', '' ],
            [ 'mobile', '' ],
        ]);
        return success(( new OrderService() )->getDeliveryPackage($data));
    }


}
